<?php
require_once 'peetweet.php';
require_once 'phprpc/phprpc_server.php';

if (!isset($_SESSION['peetweet'])) {  
    $_SESSION['peetweet'] = new peetweet();
    if (isset ($_COOKIE['pt_usr']) && isset ($_COOKIE['pt_psw'])) {
        $_SESSION['peetweet']->setUsername($_COOKIE['pt_usr']);
        $_SESSION['peetweet']->setEncryptedPassword($_COOKIE['pt_psw']);
    }
}

$twitter = $_SESSION['peetweet'];

$server = new PHPRPC_Server();  
$server->add(get_class_methods($twitter), $twitter);
$server->start();
?>

